﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="OperatorsList.ascx.cs"
    Inherits="OperatorsList" %>
   
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
    OnRowDataBound="OperatorsListGridView_RowDataBound" DataKeyNames="OperatorId"
    OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
    <Columns>
        <asp:CommandField ShowSelectButton="True" />
        <asp:BoundField DataField="Ф.И.О." HeaderText="Ф.И.О." SortExpression="Ф.И.О.">
            <ItemStyle Width="200px" />
        </asp:BoundField>
        <asp:BoundField DataField="E-mail" HeaderText="E-mail" SortExpression="E-mail">
            <ItemStyle Width="200px" />
        </asp:BoundField>
        <asp:BoundField DataField="UserName" HeaderText="Логин" SortExpression="UserName">
            <ItemStyle Width="150px" />
        </asp:BoundField>
         <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="DeleteLink" runat="server" OnClick="DeleteClicked">Удалить</asp:LinkButton>
                            </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="TransferClientsLink" runat="server" OnClick="TransferClientsClicked">Передать клиентов</asp:LinkButton>
                            </ItemTemplate>
                            </asp:TemplateField>
    </Columns>
    <EmptyDataTemplate>
        Операторов нет.
    </EmptyDataTemplate>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    SelectCommand="SELECT Operator.Name AS [Ф.И.О.], aspnet_Membership.Email AS [E-mail], aspnet_Users.UserName, Operator.OperatorId FROM Operator INNER JOIN aspnet_Users ON Operator.UserId = aspnet_Users.UserId INNER JOIN aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId"
    DeleteCommand="DELETE FROM Operator WHERE OperatorId=@OperatorId" >
     <DeleteParameters>
        <asp:Parameter Name="OperatorId" />
        </DeleteParameters>
</asp:SqlDataSource>
